home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1995 November / Macworld Nov ’95.toast / Education / xModels 2D and 3D / Tutorial Examples / Tutorial 3. Animation < prev    next >
Encoding:
Text File  |  1995-06-22  |  3.7 KB  |  84 lines  |  [TEXT/X_#9]

  1. ; Tutorial 3: Animation
  2. ;
  3. ; An animation consists of a sequence of frames.  Each frame
  4. ; contains a separate image.  The differences between one 
  5. ; image and the next should be fairly small.  When the frames
  6. ; are played back, the viewer will (hopefully) perceive
  7. ; continuous motion.
  8. ;
  9. ; In xModels-2D and xModels-3D, a file that specifies an
  10. ; animation must begin--except for comments--with the word
  11. ; "animate" and a speification of the number of frames in
  12. ; the animation.  For example:
  13.  
  14.         animate 30  ; This file defines a 30-frame animation.
  15.  
  16. ; In an animation, you can have objects that move, rotate,
  17. ; and change size.  If you say "square scale 2:5", for example,
  18. ; you will get a square that starts in frame 1 with a scale
  19. ; factor of 2 and ends in the last frame with a scale factor
  20. ; of 5.  As you view the animation, you will see a 2-by-2
  21. ; square gradually increase in size until it is a 5-by-5
  22. ; square.  The "2:5" represents a range of values, where
  23. ; each frame will use a different value.
  24. ;
  25. ; You can use value ranges in any transformation and even for
  26. ; the vertices of a polygon.  For example:
  27.  
  28.      graysquare scale 5 rotate 0:90 translate -5,5
  29.      blacksquare scale 1:5 translate 5,5
  30.      circle scale 2 translate -7:7,0
  31.      polygon  -5,-8  0:-5,-2  0:5,-2  5,-8 
  32.  
  33. ; Render this file to see this animation.  The gray square
  34. ; rotates through a 90-degree angle.  The black square
  35. ; grows from size 1 to size 5.  The circle moves across the
  36. ; window from left to right, and the polygon "morphs" from
  37. ; a triangle with vertices at (-5,-8), (0,-2) and (5,8)
  38. ; to a rectangle with vertices at (-5,-8), (-5,-2), (5,-2),
  39. ; and (5,8).
  40. ;
  41. ; The Speed Menu controls the speed at which the animation
  42. ; is played.  At the "Fastest" speed, the animation is played
  43. ; back as quickly as possible.  If you have a slow Mac, this
  44. ; might actually be no faster than the "Normal" speed.
  45. ;
  46. ; Ordinarily, an animation will replay itself over and over.
  47. ; This behavior is controlled by three options in the
  48. ; Control Menu:  "Play Once Through", "Loop Back to Start",
  49. ; and "Loop Back and Forth".  Only one of these options can
  50. ; be selected.  Experiment with them as an animation is playing
  51. ; to see how they work.
  52. ;
  53. ; The five commands at the top of the Control menu should be
  54. ; mostly self explanatory.  The last command in this menu,
  55. ; "Save Frames to Memory", needs more explanation about how the
  56. ; program works.
  57. ;
  58. ; When the program draws an image, it actually draws it to
  59. ; a piece of memory called a "bitmap".  A bitmap hols an
  60. ; image that can be quickly displayed on the screen, so 
  61. ; that you don't have to watch the process of drawing it.
  62. ; When the "Save Frames to Memory" option is checked, the
  63. ; program will draw each frame to a separate bitmap.  This takes
  64. ; a lot of memory, and only so many bitmaps can be stored in
  65. ; memory at one time--and this in turn puts a limit on the
  66. ; number of frames you can have in an animation.  The advantage
  67. ; is that once all the frames are drawn, they can be displayed
  68. ; very quickly.  (You will notice that the first time a
  69. ; complex animation is played through, it will run more slowly
  70. ; than it does after all the frames have been created.)
  71. ;
  72. ; You can get around the limitation on the number of frames
  73. ; by turning off the "Save Frames to Memory" option.  Then the
  74. ; computer will draw each frame one at a time, display it and
  75. ; discard it.  You can have an unlimited number of frames, but
  76. ; except for fairly simple scenes, you won't be able to play
  77. ; them as quickly.
  78. ;
  79. ; TIP:  The program will use a smaller drawing window if the
  80. ; usual window won't fit on your computer screen.  Using a
  81. ; smaller window lets it have more frames in memory.  You
  82. ; can force the program to use the smaller window by holding
  83. ; down the Command key as the program stars up.
  84.